From: Matthias Mullie Date: Mon, 25 Aug 2014 14:42:43 +0000 (+0200) Subject: Allow hook subscribers to also overwrite link to title X-Git-Tag: 1.31.0-rc.0~14189^2~1 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=81693d147b8ea08d9f7a48ba8ff48c1e0f4f9848;p=lhc%2Fweb%2Fwiklou.git Allow hook subscribers to also overwrite link to title Flow, for example, has those totally illegible Titles like Topic:S0gx52fzru1680ib - instead, we'd rather use the topic title content as link text. Change-Id: I30b3bbb2c5ef131f069a5aabfad8b88bc2cf09df --- diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index cd4e6680c8..09133f7460 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -67,6 +67,8 @@ production. instead. === New features in 1.24 === +* Added new argument &$link in hook WatchlistEditorBuildRemoveLine, allowing the + link to the title to be changed. * Added a new hook, "WhatLinksHereProps", to allow extensions to annotate WhatLinksHere entries. * Added a new hook, "ContentGetParserOutput", to customize parser output for diff --git a/docs/hooks.txt b/docs/hooks.txt index d704eb54be..106884b325 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2944,6 +2944,7 @@ Special:Watchlist/edit. $title: Title object $redirect: whether the page is a redirect $skin: Skin object +&$link: HTML link to title 'WebRequestPathInfoRouter': While building the PathRouter to parse the REQUEST_URI. diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index 76f2f4a940..73438d9b85 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -620,11 +620,6 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { private function buildRemoveLine( $title ) { $link = Linker::link( $title ); - if ( $title->isRedirect() ) { - // Linker already makes class mw-redirect, so this is redundant - $link = '' . $link . ''; - } - $tools[] = Linker::link( $title->getTalkPage(), $this->msg( 'talkpagelinktext' )->escaped() ); if ( $title->exists() ) { @@ -645,9 +640,14 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { wfRunHooks( 'WatchlistEditorBuildRemoveLine', - array( &$tools, $title, $title->isRedirect(), $this->getSkin() ) + array( &$tools, $title, $title->isRedirect(), $this->getSkin(), &$link ) ); + if ( $title->isRedirect() ) { + // Linker already makes class mw-redirect, so this is redundant + $link = '' . $link . ''; + } + return $link . " (" . $this->getLanguage()->pipeList( $tools ) . ")"; }